package com.cloud.bssp.netty.bytebuf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;

/**
 * @description： TODO
 * @author：weirx
 * @date：2021/11/11 9:36
 * @version：3.0
 */
public class CreateByteBufTest {

    public static void main(String[] args) {
        //创建一个容量为10的ByteBuf，默认是直接内存
        ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(10);
        System.out.println(buf);

        //创建一个堆内存buf
        ByteBuf heapBuffer = ByteBufAllocator.DEFAULT.heapBuffer(10);
        System.out.println(heapBuffer);

        //创建一个直接内存buf
        ByteBuf directBuffer = ByteBufAllocator.DEFAULT.directBuffer(10);
        System.out.println(directBuffer);
    }
}
